﻿using DelonixRegiaHotel.Classes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DelonixRegiaHotel
{
    public partial class CreateAdmin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnAdmin_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("~/Admin.aspx");
        }

        protected void btnCheckIn_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("~/CheckIn.aspx");
        }

        protected void btnCheckOut_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("~/CheckOut.aspx");
        }

        protected void btnQuery_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("~/Query.aspx");
        }

        protected void btnRates_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("~/Rates.aspx");
        }

        protected void btnBooking_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("~/RoomAvailability.aspx");
        }

        protected void btnStaff_Click(object sender, ImageClickEventArgs e)
        {

        }

        protected void btnReport_Click(object sender, ImageClickEventArgs e)
        {

        }

        protected void btnLogout_Click(object sender, ImageClickEventArgs e)
        {

        }

        protected void btnLogo_Click(object sender, ImageClickEventArgs e)
        {

        }

        protected void btnCreateAdmin_Click(object sender, EventArgs e)
        {
            String username = tbxCreateUsername.Text;
            String password = tbxCreatePassword.Text;
            String name = tbxCreateName.Text;
            String dob = tbxCreateDob.Text;
            String bank_account_number = tbxCreateBankaccountnum.Text;
            String home_address = tbxCreateHomeaddress.Text;
            String tel_num = tbxCreateTelno.Text;
            String rank = ddlRank.SelectedValue;

            HotelUser u = new HotelUser(username, password, name, dob, bank_account_number, home_address, tel_num, rank);

            int rowsreturned = DBManager.createAdmin(u);

            if (rowsreturned > 0)
                lblStatus.Text = "Admin Has Been Successfully Created!";
        }
    }
}